class MyPlugin {
    constructor(options) {
        console.log('myplugin被创建了')
        console.log(options)
        this.options = options
    }
    apply(compiler) {
        compiler.hooks.emit.tapPromise('DemoWebpackPlugin', async (compilation) => {
            await new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve()
                }, 1000)
            })
            console.log(compilation.assets)
            compilation.assets['myplugin.md'] = {
                // 文件内容
                source: function () {
                    return 'this is a demo for myplugin'
                },
                // 文件尺寸
                size: function () {
                    return 25
                }
            }
        })
    }
 }
module.exports = MyPlugin